from django.db import models


# Create your models here.

class Main(models.Model):
    img = models.CharField(max_length=256)
    name = models.CharField(max_length=64)
    track_id = models.IntegerField(default=1)

    class Meta:
        abstract = True


class MainWheel(Main):
    """
    axf_wheel(img, name, track_id)
    """

    class Meta:
        db_table = 'axf_wheel'


class MainNav(Main):
    """
    axf_nav(img, name, track_id)
    """

    class Meta:
        db_table = 'axf_nav'


class MainMustBuy(Main):
    """
    axf_must_buy(img, name, track_id)
    """

    class Meta:
        db_table = 'axf_must_buy'


class MainShop(Main):
    """
    axf_shop(img, name, track_id)
    """

    class Meta:
        db_table = 'axf_shop'


class MainShow(Main):
    """
    axf_show(track_id, name, img, category_id, brand_name, child_id1, product_id1, long_name1, price1, market_price1,
    img2, child_id2, product_id2, long_name2, price2, market_price2, img3, child_id3, product_id3, long_name3, price3,
    market_price3)
    """
    category_id = models.IntegerField(default=1)
    brand_name = models.CharField(max_length=64)
    img1 = models.CharField(max_length=255)
    child_id1 = models.IntegerField(default=1)
    product_id1 = models.IntegerField(default=1)
    long_name1 = models.CharField(max_length=128)
    price1 = models.FloatField(default=1)
    market_price1 = models.FloatField(default=0)
    img2 = models.CharField(max_length=255)
    child_id2 = models.IntegerField(default=1)
    product_id2 = models.IntegerField(default=1)
    long_name2 = models.CharField(max_length=128)
    price2 = models.FloatField(default=1)
    market_price2 = models.FloatField(default=0)
    img3 = models.CharField(max_length=255)
    child_id3 = models.IntegerField(default=1)
    product_id3 = models.IntegerField(default=1)
    long_name3 = models.CharField(max_length=128)
    price3 = models.FloatField(default=1)
    market_price3 = models.FloatField(default=0)

    class Meta:
        db_table = 'axf_main_show'


class FoodType(models.Model):
    """
    axf_food_type(type_id, type_name, child_type_name, type_sort)
    """
    type_id = models.IntegerField(default=1)
    type_name = models.CharField(max_length=32)
    child_type_name = models.CharField(max_length=255)
    type_sort = models.IntegerField(default=1)

    class Meta:
        db_table = 'axf_food_type'


class Goods(models.Model):
    """
    axf_goods(productid,productimg,productname,productlongname,isxf,pmdesc,specifics,price,marketprice,categoryid,childcid,childcidname,dealerid,storenums,productnum)
    """
    product_id = models.IntegerField(default=1)
    product_img = models.CharField(max_length=255)
    product_name = models.CharField(max_length=128)
    product_long_name = models.CharField(max_length=255)
    is_xf = models.BooleanField(default=False)
    pm_desc = models.BooleanField(default=False)
    specifics = models.CharField(max_length=64)
    price = models.FloatField(default=1)
    market_price = models.FloatField(default=1)
    category_id = models.IntegerField(default=1)
    child_id = models.IntegerField(default=1)
    child_name = models.CharField(max_length=128)
    dealer_id = models.IntegerField(default=1)
    store_nums = models.IntegerField(default=1)
    product_num = models.IntegerField(default=1)

    class Meta:
        db_table = "axf_goods"


class AXFUsers(models.Model):
    """
    axf_user(username, password, email, icon, is_active, is_delete)
    """
    u_username = models.CharField(max_length=32, unique=True)
    u_password = models.CharField(max_length=256)
    u_email = models.CharField(max_length=64, unique=True)
    u_icon = models.ImageField(upload_to='icons/%Y/%m/%d')
    is_active = models.BooleanField(default=False)
    is_delete = models.BooleanField(default=False)

    class Meta:
        db_table = "axf_user"
